To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Adding Workdays to a Date
Send Email Using a DNS Server
Preserve Browser Scroll Position After a Postback
Anonymous Types
Build an AJAX Content Management System with Visual WebGUI: Adding Menu Components



Go Back   VBForums > VBForums CodeBank > CodeBank - Visual Basic 6 and earlier
Register FAQ Calendar Today's Posts VB Jobs Search

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old Mar 9th, 2007, 05:23 AM   #1
yogiyang
Junior Member
 
Join Date: Mar 07
Posts: 24
yogiyang is on a distinguished road (10+)
Code : Hard Disk Serial Number (firmware #)

Get your PCs hard disk drive firm ware number (the number that does not change and that is added by the HDD manufacturer during manufacturing of HDD).

Check it out!
Attached Files
File Type: zip HDD_FirmWare#.zip (5.2 KB, 4673 views)
yogiyang is offline   Reply With Quote
Old Apr 8th, 2007, 12:56 PM   #2
Eftim Stoyanov
New Member
 
Join Date: Apr 07
Posts: 1
Eftim Stoyanov is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Dear Sir,

I have downloaded your program. It seems great! Will you be so kind to send me some explanation how to install and use the programs. Loading the programs into VB 6.0 (may be rong), in the combibox there is no results! Thank you in advance!
Eftim Stoyanov

Last edited by Hack; Apr 20th, 2007 at 01:01 PM. Reason: Removed Email Address
Eftim Stoyanov is offline   Reply With Quote
Old Apr 20th, 2007, 08:14 AM   #3
stuckonsomething
New Member
 
Join Date: Oct 06
Posts: 10
stuckonsomething is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Thank you YogiYang you deserve a medal for sharing this
stuckonsomething is offline   Reply With Quote
Old May 2nd, 2007, 09:35 AM   #4
Yogi Yang
New Member
 
Join Date: Jul 04
Posts: 13
Yogi Yang is an unknown quantity at this point (<10)
Resolved Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by Eftim Stoyanov
Dear Sir,

I have downloaded your program. It seems great! Will you be so kind to send me some explanation how to install and use the programs. Loading the programs into VB 6.0 (may be rong), in the combibox there is no results! Thank you in advance!
Eftim Stoyanov
Please read the document in the zip file and use your head a bit.
__________________
Thanks,

Yogi Yang

Yogi's SoftKey a keyboard remappint software for Indian Languages. Worlds easiest to learn and use for Indian Languages (Gujarati/Hindi).
Yogi Yang is offline   Reply With Quote
Old May 2nd, 2007, 10:09 AM   #5
Ellis Dee
PowerPoster
 
Ellis Dee's Avatar
 
Join Date: Mar 07
Location: New England
Posts: 2,805
Ellis Dee is a glorious beacon of light (400+)Ellis Dee is a glorious beacon of light (400+)Ellis Dee is a glorious beacon of light (400+)Ellis Dee is a glorious beacon of light (400+)Ellis Dee is a glorious beacon of light (400+)
Re: Code : Hard Disk Serial Number (firmware #)

Fantastic contribution.

I'd like to incorporate this into my library. Do you have any objection?

If you'd like me to give credit to a name other than "yogiyang", PM me.
Ellis Dee is offline   Reply With Quote
Old May 18th, 2007, 02:32 AM   #6
Yogi Yang
New Member
 
Join Date: Jul 04
Posts: 13
Yogi Yang is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by Ellis Dee
Fantastic contribution.

I'd like to incorporate this into my library. Do you have any objection?

If you'd like me to give credit to a name other than "yogiyang", PM me.
No objections at all. I will be that my code is usefull to someone.

But I must say that I am not able to get this code to work properly in VISTA Final Release. It was working in the FirstBeta version but not in final release.

Good luck to you.

Yogi Yang
__________________
Thanks,

Yogi Yang

Yogi's SoftKey a keyboard remappint software for Indian Languages. Worlds easiest to learn and use for Indian Languages (Gujarati/Hindi).
Yogi Yang is offline   Reply With Quote
Old May 19th, 2007, 12:12 AM   #7
raouf505
New Member
 
Join Date: May 07
Location: Tunisia
Posts: 3
raouf505 is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Thank you yogiyang
raouf505 is offline   Reply With Quote
Old Aug 29th, 2007, 04:34 AM   #8
randem
Banned
 
randem's Avatar
 
Join Date: Oct 02
Location: Maui, Hawaii
Posts: 11,386
randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)
Re: Code : Hard Disk Serial Number (firmware #)

Handy piece of code...
randem is offline   Reply With Quote
Old Sep 11th, 2007, 05:06 AM   #9
nepalbinod
Lively Member
 
Join Date: Sep 07
Posts: 78
nepalbinod is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

I have already used your code in my project for security. It is really helpful, but please let us know if you have the same thing for SATA hard disks too.
nepalbinod is offline   Reply With Quote
Old Sep 12th, 2007, 10:15 AM   #10
Yogi Yang
New Member
 
Join Date: Jul 04
Posts: 13
Yogi Yang is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by nepalbinod
I have already used your code in my project for security. It is really helpful, but please let us know if you have the same thing for SATA hard disks too.
I own two SATA HDDs and it is working without any problem. There must be some other problem at you end.
If you are having problem using this library then please use WMI for extracting storage media information and then separate the HDDs firmware from it.

By the way this will not work with all types of SCSI HDDs as far as my experience goes
__________________
Thanks,

Yogi Yang

Yogi's SoftKey a keyboard remappint software for Indian Languages. Worlds easiest to learn and use for Indian Languages (Gujarati/Hindi).
Yogi Yang is offline   Reply With Quote
Old Sep 12th, 2007, 11:07 AM   #11
Hack
Super Moderator
 
Hack's Avatar
 
Join Date: Aug 01
Location: Sterling Heights, Michigan
Posts: 50,956
Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)Hack has much to be proud of (1500+)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by Yogi Yang
No objections at all. I will be that my code is usefull to someone.

But I must say that I am not able to get this code to work properly in VISTA Final Release. It was working in the FirstBeta version but not in final release.

Good luck to you.

Yogi Yang
What problems is Vista giving you?
__________________
Please use [Code]your code goes in here[/Code] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum.

Creating A Wizard In VB.NET
Modifications Required For VB6 Apps To Work On Vista
Paging A Recordset
What is wrong with using On Error Resume Next
IT professionals freelancer site. Register today to find coders, or offer your services for available freelance projects!
Microsoft MVP 2005/2006/2007/2008/2009
Hack is offline   Reply With Quote
Old Sep 27th, 2007, 08:15 AM   #12
yogiyang
Junior Member
 
Join Date: Mar 07
Posts: 24
yogiyang is on a distinguished road (10+)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by Hack
What problems is Vista giving you?
My program is not throwing any errors. Just nothing seems to happen and no data is returned. I don't know what is wrong.

Currently I am busy on another project which involves a lot of programming as it is regarding Image Processing.

Will try to find a solution when free
yogiyang is offline   Reply With Quote
Old Nov 14th, 2007, 12:44 AM   #13
riech
New Member
 
Join Date: Nov 07
Posts: 5
riech is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

nice code !!
Expecting code to co-operate with vista and SCSI hard disk
riech is offline   Reply With Quote
Old Nov 17th, 2007, 12:41 AM   #14
yogiyang
Junior Member
 
Join Date: Mar 07
Posts: 24
yogiyang is on a distinguished road (10+)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by riech
nice code !!
Expecting code to co-operate with vista and SCSI hard disk
I will look into this but later as currently it is not in my priority list.

I am currently absorbed with Delphi as I am planning to switch to Delphi for all my mainstream software development.

Any way thanks for your interest.
yogiyang is offline   Reply With Quote
Old Nov 29th, 2007, 04:34 AM   #15
riech
New Member
 
Join Date: Nov 07
Posts: 5
riech is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

expecting code for vista

[Email address removed; communication of these should be done by PM — Mod]
riech is offline   Reply With Quote
Old Nov 29th, 2007, 03:58 PM   #16
randem
Banned
 
randem's Avatar
 
Join Date: Oct 02
Location: Maui, Hawaii
Posts: 11,386
randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)
Re: Code : Hard Disk Serial Number (firmware #)

There is another approach using Wmi That does work on Vista. Search for it. I will post it if I find it.
randem is offline   Reply With Quote
Old Nov 30th, 2007, 03:11 AM   #17
riech
New Member
 
Join Date: Nov 07
Posts: 5
riech is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Please send me the code
isn't that code work with SCSI drives ?
riech is offline   Reply With Quote
Old Nov 30th, 2007, 04:22 AM   #18
randem
Banned
 
randem's Avatar
 
Join Date: Oct 02
Location: Maui, Hawaii
Posts: 11,386
randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)
Re: Code : Hard Disk Serial Number (firmware #)

I forgot who originally posted it but here it is
Code:
Option Explicit

Public Function GetHDSerialNumber() As String()
Dim arrComputers() As String
Dim strComputer As Variant
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
Const wbemFlagReturnImmediately = &H10
Const wbemFlagForwardOnly = &H20
Dim arHD() As String
Dim i As Integer


    On Error Resume Next
    
    arrComputers = Array(".")
    For Each strComputer In arrComputers
       Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
       Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMedia", "WQL", _
                                              wbemFlagReturnImmediately + wbemFlagForwardOnly)
                                              
       
       For Each objItem In colItems
          Debug.Print "SerialNumber: " & objItem.SerialNumber
          Debug.Print "Tag: " & objItem.Tag
          Debug.Print
            ReDim Preserve arHD(i)
            arHD(i) = Trim(objItem.SerialNumber)
            i = i + 1
       Next
    Next

    GetHDSerialNumber = arHD
    
    Set colItems = Nothing
    Set objWMIService = Nothing
    
End Function
randem is offline   Reply With Quote
Old Dec 2nd, 2007, 01:42 AM   #19
Yogi Yang
New Member
 
Join Date: Jul 04
Posts: 13
Yogi Yang is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by randem
I forgot who originally posted it but here it is
Code:
Option Explicit

Public Function GetHDSerialNumber() As String()
Dim arrComputers() As String
Dim strComputer As Variant
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
Const wbemFlagReturnImmediately = &H10
Const wbemFlagForwardOnly = &H20
Dim arHD() As String
Dim i As Integer


    On Error Resume Next
    
    arrComputers = Array(".")
    For Each strComputer In arrComputers
       Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
       Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMedia", "WQL", _
                                              wbemFlagReturnImmediately + wbemFlagForwardOnly)
                                              
       
       For Each objItem In colItems
          Debug.Print "SerialNumber: " & objItem.SerialNumber
          Debug.Print "Tag: " & objItem.Tag
          Debug.Print
            ReDim Preserve arHD(i)
            arHD(i) = Trim(objItem.SerialNumber)
            i = i + 1
       Next
    Next

    GetHDSerialNumber = arHD
    
    Set colItems = Nothing
    Set objWMIService = Nothing
    
End Function
Thanks for the code snippet. But the main problem is that the code that I have developed is for running on all Windows 32Bit versions and not only in Windows 2000 onwards.

The WMI part is easy but a user can easily disable or uninstall WMI from his or her system and this will break any software which is built around WMI.

I am not interested in that......

Now that you already have code for extracting HDD serial using WMI please update my code and repost it.

Thanks in advance.
__________________
Thanks,

Yogi Yang

Yogi's SoftKey a keyboard remappint software for Indian Languages. Worlds easiest to learn and use for Indian Languages (Gujarati/Hindi).
Yogi Yang is offline   Reply With Quote
Old Dec 5th, 2007, 10:51 AM   #20
riech
New Member
 
Join Date: Nov 07
Posts: 5
riech is an unknown quantity at this point (<10)
Angry Re: Code : Hard Disk Serial Number (firmware #)

Why it is deficult to get the out put in Vesta ?
riech is offline   Reply With Quote
Old Dec 7th, 2007, 03:39 AM   #21
yogiyang
Junior Member
 
Join Date: Mar 07
Posts: 24
yogiyang is on a distinguished road (10+)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by riech
Why it is deficult to get the out put in Vesta ?
To tell the truth VISTA itself is very difficult for me to grasp and adopt. it is tooooo for me.

I am using Win XP on a p4, 1GHz processor having 128 MB RAM. Will VISTA run on this without a hitch? Of course not. Currently XP's log in screen comes up in just 20 seconds after booting my PC. What would happen in case of VISTA

I will eventually upgrade to VISTA when I upgrade my Hardware and when VISTA becomes more use able and less buggy
yogiyang is offline   Reply With Quote
Old Dec 25th, 2007, 02:12 AM   #22
yogiyang
Junior Member
 
Join Date: Mar 07
Posts: 24
yogiyang is on a distinguished road (10+)
Thumbs up Re: Code : Hard Disk Serial Number (firmware #)

I found a Class for reading HDD Firmware which is very easy to use... Check it out. It is not mine. It is developed by a Spanish

' Oggetto HDSN
' Esempio d'uso

Chek attachment.
Attached Files
File Type: cls HDSN.cls (9.2 KB, 836 views)
yogiyang is offline   Reply With Quote
Old Mar 3rd, 2008, 03:18 AM   #23
riech
New Member
 
Join Date: Nov 07
Posts: 5
riech is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Any develop using Vista ?
riech is offline   Reply With Quote
Old Mar 4th, 2008, 12:11 AM   #24
yogiyang
Junior Member
 
Join Date: Mar 07
Posts: 24
yogiyang is on a distinguished road (10+)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by riech
Any develop using Vista ?
To tell you the truth. Vista is not in my radar as currently I am switching to Delphi for all my software development.

You will have to try something by yourself as I will not be able to help you out. Sorry.
yogiyang is offline   Reply With Quote
Old Mar 7th, 2008, 11:15 PM   #25
matthewetaft2008
New Member
 
Join Date: Mar 08
Posts: 1
matthewetaft2008 is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Hi Everyone,

This is the best piece of code I've found for this, and YES!!! IT WORKS WITH VISTA!!! I had the same "error" as mentioned above, with the fields just being blank. I played around for a while, and the "blank fields" are due to User Account Control in Vista. The CreateFile function that is called needs to have administrative permissions (see http://msdn2.microsoft.com/en-us/lib...8(VS.85).aspx).

If you're developing an app that you'll only run yourself, you can just right-click the application and choose "Run as Administrator." For real world software, you'll need a Vista UAC work around. I haven't done this in VB, but I've done it in NSIS Installer successfully, so there's a way to do it. I just haven't got there yet. In my installer, if I don't have adequate permissions, I prompt the user to type in an administrative password so that I can gain these permissions. I'm going to be looking for a more pretty way to handle this in software, so that my users don't see this message whenever they start the software.
matthewetaft2008 is offline   Reply With Quote
Old Apr 3rd, 2008, 08:31 AM   #26
yogiyang
Junior Member
 
Join Date: Mar 07
Posts: 24
yogiyang is on a distinguished road (10+)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by matthewetaft2008
Hi Everyone,

This is the best piece of code I've found for this, and YES!!! IT WORKS WITH VISTA!!! I had the same "error" as mentioned above, with the fields just being blank. I played around for a while, and the "blank fields" are due to User Account Control in Vista. The CreateFile function that is called needs to have administrative permissions (see http://msdn2.microsoft.com/en-us/lib...8(VS.85).aspx).

If you're developing an app that you'll only run yourself, you can just right-click the application and choose "Run as Administrator." For real world software, you'll need a Vista UAC work around. I haven't done this in VB, but I've done it in NSIS Installer successfully, so there's a way to do it. I just haven't got there yet. In my installer, if I don't have adequate permissions, I prompt the user to type in an administrative password so that I can gain these permissions. I'm going to be looking for a more pretty way to handle this in software, so that my users don't see this message whenever they start the software.
Thank you for solving the problem. I thought I was the only one who was responsible for solving the problem (and not having Vista I could not) as no one was extending a helping hand in this regards.

If you do find a work around for prompting for Administrative Password please do share it with us here on this forum.

Thanks again.

Regards,

Yogi Yang
yogiyang is offline   Reply With Quote
Old Jun 26th, 2008, 12:45 AM   #27
dicktracy007
Member
 
Join Date: Apr 08
Posts: 46
dicktracy007 is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Hi Yogi,

Great Post. I too wish to include this in my app but do not know how. And there is no Notepad or instruction file in the downloaded zip file. Pray help..
dicktracy007 is offline   Reply With Quote
Old Jun 27th, 2008, 04:52 AM   #28
yogiyang
Junior Member
 
Join Date: Mar 07
Posts: 24
yogiyang is on a distinguished road (10+)
Smile Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by dicktracy007
Hi Yogi,

Great Post. I too wish to include this in my app but do not know how. And there is no Notepad or instruction file in the downloaded zip file. Pray help..
It is simple. Just take the necessary code files and add them to your existing project. Now call the necessary functions to retrive HDD's serial number. That is it.

Still more easier is to use the class "HDSN.cls" that I have uploaded later. It is a class which has to be instantiated. Now call necessary methods to get the serial number.

I don't know how else should I help you on this.

Regards,

Yogi Yang
yogiyang is offline   Reply With Quote
Old Jul 1st, 2009, 09:54 PM   #29
Deliriumxx
Addicted Member
 
Join Date: Jun 08
Posts: 170
Deliriumxx is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Does this last class work with Vista and Windows 7
Deliriumxx is offline   Reply With Quote
Old Sep 8th, 2009, 03:34 PM   #30
mustiback
New Member
 
Join Date: Sep 08
Posts: 15
mustiback is an unknown quantity at this point (<10)
Re: Code : Hard Disk Serial Number (firmware #)

Thank You (:
mustiback is offline   Reply With Quote
Old Today, 10:12 AM   #31
yogiyang
Junior Member
 
Join Date: Mar 07
Posts: 24
yogiyang is on a distinguished road (10+)
Re: Code : Hard Disk Serial Number (firmware #)

Quote:
Originally Posted by mustiback View Post
Thank You (:
You are welcome
yogiyang is offline   Reply With Quote
Reply

Go Back   VBForums > VBForums CodeBank > CodeBank - Visual Basic 6 and earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:09 PM.



MARKETPLACE
Advertise Here

Internet.com Freelancer Projects
Projects Open for Bid!

  • SQL Data Migration Specialist
    Overview The SQL Data Migration Specialist plays a crucial role in converting new Client's data onto Brilig's service platforms. We are looking for a talented and energetic full-time freelance pr ...
  • Website for house advertisements
    I want to develop a website to publish private user advertisements. The users have to regerister and fill forms for their advertisements . Google maps integration to locate the houses, pictures are ...
  • adapt design template from OSC to XTC
    Hello, I have a osc-template and with my OS Commerce Shop. Now I want to adapt my shop to an XTC Shop. For that I need a developer which can adapt my used design template from OSC to XTC. ...
  • Open Source Programming Writer
    We are looking for authors to cover open source topics like Ruby, Python, Java, RoR, PHP, Perl and more. The articles would be mostly short tutorial type articles.
  • send sms through nokia mobile
To view more projects, click here
Click Here